package com.lmb.service.impl;

import com.lmb.bean.EmergencyEvents;
import com.lmb.mapper.EmergencyEventsDao;
import com.lmb.service.EmergencyEventsService;
import com.lmb.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmergencyEventsServiceImpl implements EmergencyEventsService {
    @Autowired
    EmergencyEventsDao emergencyEventsDao;

    @Override
    public EmergencyEvents add(EmergencyEvents emergencyEvents) {
        emergencyEventsDao.add(emergencyEvents);
        EmergencyEvents result=emergencyEventsDao.one(emergencyEvents.getEvent_id());
        return result;
    }

    @Override
    public EmergencyEvents edit(EmergencyEvents emergencyEvents) {
        emergencyEventsDao.edit(emergencyEvents);
        EmergencyEvents result=emergencyEventsDao.one(emergencyEvents.getEvent_id());
        return result;
    }

    @Override
    public int del(Integer id) {
        return emergencyEventsDao.del(id);
    }

    @Override
    public EmergencyEvents one(Integer id) {
        return emergencyEventsDao.one(id);
    }

    @Override
    public List<EmergencyEvents> all(EmergencyEvents emergencyEvents) {

        return emergencyEventsDao.all(emergencyEvents);
    }

    @Override
    public void page(Page page, EmergencyEvents emergencyEvents) {
        int count= emergencyEventsDao.pageCount(emergencyEvents);
        Object data= emergencyEventsDao.page(page, emergencyEvents);
        page.setCount(count);
        page.setData(data);
    }
}
